package edu.webtek.cloudresp;

import java.util.ArrayList;
import java.util.Iterator;

import org.jdom2.Document;
import org.jdom2.Element;

import edu.webtek.clouddata.Shop;

public class RespShops extends RespBase implements Iterable<Shop> {
	final private ArrayList<Shop> shops = new ArrayList<Shop>();
	
	public RespShops(Document resp) {
		if(resp == null){
			flagResponseError();
			return;
		}
		Element shops = resp.getRootElement();
		for(Element shop : shops.getChildren()){
			this.shops.add(new Shop(shop));
		}
	}
	
	@Override
	public Iterator<Shop> iterator() {
		return shops.iterator();
	}	
}
